﻿using ApprovalFlow.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ApprovalFlow.Interface
{
    public interface IEventRepository
    {
        /// <summary>
        /// 创建事件。
        /// </summary>
        /// <param name="newEvent"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<string> CreateEvent(Event newEvent, CancellationToken cancellationToken = default);

        /// <summary>
        /// 通过id获取事件详情。
        /// </summary>
        /// <param name="id"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<Event> GetEvent(string id, CancellationToken cancellationToken = default);

        //Task<IEnumerable<string>> GetRunnableEvents(DateTime asAt, CancellationToken cancellationToken = default);

        //Task<IEnumerable<string>> GetEvents(string eventName, string eventKey, DateTime asOf, CancellationToken cancellationToken = default);

        /// <summary>
        /// 标记已处理的事件。
        /// </summary>
        /// <param name="id"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task MarkEventProcessed(string id, CancellationToken cancellationToken = default);

        /// <summary>
        /// 标记未处理的事件。
        /// </summary>
        /// <param name="id"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task MarkEventUnprocessed(string id, CancellationToken cancellationToken = default);
    }
}
